var dbdatePickerValidator = (rule, value, callback) => {
    if (!value.length) {
        callback(new Error('请选择日期'));
    } else {
        for (let index = 0; index < value.length; index++) {
            const element = value[index];
            if (element == '') {
                callback(new Error('请选择日期'));
            } else {
                callback();
            }
        }
    }
}
let configOption = {
    isShow: true,
    name: 'formInLine',
    labelWidth: 180,
    form: [
        { type: 'inputBtnBefore', dataType: 'text', key: 'button', label: '尾部按钮',  placeholder: '尾部按钮',btnName:'计算', default: '',bgColor:'#2d8cf0',color:'#fff',btnWidth:'80px',event:function(){} },
        { type: 'input', dataType: 'text', key: 'iconInput', label: '带图标input框', icon: 'ios-person-outline', placeholder: 'Username', default: '' },
        { type: 'input', dataType: 'text', key: 'input', label: '不带图标input', icon: '', disabled: true, placeholder: 'Password', default: '' },
        {
            type: 'select', key: 'selectSelfData', label: '下拉选择自定义数据',
            option: [{ label: '苹果', value: '01' }, { label: '橘子', value: '02' }],
            textAlign: 'left', placeholder: '请选择selectSelfData', default: ''
        },
        {
            type: 'select', key: 'selectSelfMoreData', label: '下拉选择多选',
            option: [{ label: '苹果', value: '01' }, { label: '橘子', value: '02' }],
            textAlign: 'left', multiple: true, placeholder: '请选择selectSelfMoreData', default: []
        },
        {
            type: 'select', key: 'selectSelfMoreNoData', label: '下拉选择多选非后台搜素',
            option: [{ label: '苹果', value: '01' }, { label: '橘子', value: '02' }],
            textAlign: 'left', filterable: true, // 是否查询搜索【默认根据label和value】 multiple: true, // 是否多选
            placeholder: '请选择selectSelfMoreData', default: ''
        },
        {
            type: 'select', key: 'selectSelfSEMoreData', label: '下拉选择查询多选',
            option: [], textAlign: 'left', loading: false, multiple: true, filterable: true,
            remoteMethod: (query, parames) => {
                let list = [{ label: '苹果', value: '01' }, { label: '橘子', value: '02' }];// 模拟请求返回的数据
                parames.option = []
                if (query !== '') {
                    parames.loading = true;
                    setTimeout(() => {
                        parames.loading = false;
                        parames.option = list.filter(item => item.label.toLowerCase().indexOf(query.toLowerCase()) > -1);
                    }, 1200);
                } else {
                    parames.option = [];
                }
            }, default: [],
            placeholder: '请选择selectSelfSEMoreData'
        },
        { label: 'datePicker框', key: 'datePicker', type: 'datePicker', placeholder: '请选择日期', style: {}, dataType: 'date', default: '' },
        { type: 'datePicker', key: 'dbdatePicker', label: 'datePicker日期双选', placeholder: '日期双选', style: {}, dataType: 'daterange', default: '' },
        {
            type: 'dbDatePicker', label: '双日期选择', double: {
                first: {
                    key: 'datePickerFirst', type: 'datePicker', placeholder: '请选择日期', style: {}, dataType: 'date', default: ''
                },
                second: {
                    key: 'datePickerSecond', type: 'datePicker', placeholder: '请选择日期', style: {}, dataType: 'date', default: ''
                }
            }
        },
        {
            type: 'checkBox', key: 'checkBox', label: '多选框', textAlign: 'left',
            checkBoxData: [{ lable: '鲨鱼', value: '0' }, { lable: '猫咪', value: '1' }], default: []
        },
        {
            type: 'radio', key: 'radioBox', label: '单选框', textAlign: 'left', default: 0,
            radioData: [{ lable: '写作业', value: 0 }, { lable: '玩游戏', value: 1 }]
        },
        { type: 'switch', key: 'switch', label: 'switch开关', on: '开', off: '关', default: true, },
        {
            type: 'custom', label: '自定义显示', textAlign: 'right',
            template: {
                key: 'password', label: '密码', icon: '', name: '你妈妈让我自定义显示',
                render: (h, parames) => {
                    return h('div', {
                        style: parames.selfStyle
                    }, parames.configs.name + '---你真扯淡')
                }
            }
        },
        {
            type: 'input', dataType: 'textarea', key: 'textarea', label: '不带图标input', icon: '',
            placeholder: 'Password', autosize: { minRows: 2, maxRows: 5 }, default: ''
        },
        { type: 'detial', key: 'detial', label: '详细信息展示', style: { color: 'red' } },
        { type: 'slot', key: 'chac', label: '插槽显示', name: 'myslot', }
    ],
    rules: {
        iconInput: [
            { required: true, message: '请输入iconInput', trigger: 'blur' }
        ],
        // input: [
        //     { required: true, message: '请输入input', trigger: 'change' },
        // ],
        selectSelfData: [
            { required: true, message: '请选择selectSelfData', trigger: 'change' }
        ],
        selectSelfMoreData: [
            { type: 'array', required: true, message: '请选择selectSelfMoreData', trigger: 'change' }
        ],
        selectSelfSEMoreData: [
            { type: 'array', required: true, message: '请选择selectSelfSEMoreData', trigger: 'change' }
        ],
        selectSelfMoreNoData: [
            { type: 'string', required: true, message: '请选择selectSelfMoreNoData', trigger: 'change' }
        ],
        datePicker: [
            { type: 'date', required: true, message: '请选择datePicker', trigger: 'change' }
        ],
        datePickerFirst: [
            { type: 'date', required: true, message: '请选择datePickerFirst', trigger: 'change' }
        ],
        datePickerSecond: [
            { type: 'date', required: true, message: '请选择datePickerSecond', trigger: 'change' }
        ],
        dbdatePicker: [ // 自定义验证
            { validator: dbdatePickerValidator, trigger: 'change' }
        ],
        checkBox: [
            { type: 'array', required: true, message: '请选择checkBox', trigger: 'change' },
        ],
        radioBox: [
            { type: 'number', required: true, message: '请选择radioBox', trigger: 'change' },
        ],
        textarea: [
            { required: true, message: '请输入textarea', trigger: 'change' },
        ],
    },
    grid: {
        xl: 12,
        lg: 8,
        md: 12,
        sm: 24,
        xs: 24
    },
    event: {
        iconInput: () => {
            // console.log('input框动态绑定事件%o', '执行了我')
        }
    } // 动态绑定事件
}

export { configOption }